Ext.override(Ext.form.RadioGroup, {     
				    getValue: function(){     
				        var v;     
				        if (this.rendered) {     
				            this.items.each(function(item){     
				                if (!item.getValue())      
				                    return true;     
				                v = item.getRawValue();     
				                return false;     
				            });     
				        }     
				        else {     
				            for (var k in this.items) {     
				                if (this.items[k].checked) {     
				                    v = this.items[k].inputValue;     
				                    break;     
				                }     
				            }     
				        }
				        return v;     
				    },     
				    setValue: function(v){     
				        if (this.rendered)      
				            this.items.each(function(item){     
				                item.setValue(item.getRawValue() == v);   
				            });     
				        else {     
				            for (var k in this.items) {     
				                this.items[k].checked = this.items[k].inputValue == v;     
				            }     
				        } 
				        
				    }     
				}); 

var Jthtwb_patient = Ext.data.Record.create([ {
					name : 'fpid',
					mapping : 'fpid',
					type : 'string'
				}, {
					name : 'fname',
					mapping : 'fname',
					type : 'string'
				}, {
					name : 'fstate',
					mapping : 'fstate',
					type : 'string'
				}, {
					name : 'fsex',
					mapping : 'fsex',
					type : 'string'
				}, {
					name : 'fphone1',
					mapping : 'fphone1',
					type : 'string'
				}, {
					name : 'fjwh',
					mapping : 'fjwh',
					type : 'string'
				}, {
					name : 'fadd_detail',
					mapping : 'fadd_detail',
					type : 'string'
				}, {
					name : 'fybkh',
					mapping : 'fybkh',
					type : 'string'
				}, {
					name : 'fsign_date',
					mapping : 'fsign_date',
					type : 'string'
				} ]);

		//新增签约登记
		function sign_add_fun() {
		
			//根据"医保卡号"关键字查询
			var ybkh_gjz_ds = new Ext.data.Store({
				proxy : new Ext.data.HttpProxy({
					url : 'xyj!queryTipYbkh.do',
					method : 'POST'
				}),
				reader: new Ext.data.JsonReader({
		            root: 'root',
		            totalProperty: 'totalProperty',
		            id : 'ybkh'
		        }, [
		            {name: 'fybkh'}, {name: 'fname'}, {name: 'fpid'},  {name: 'fsex'}, {name: 'fidcd'},  {name: 'fphone2'}, {name: 'fjwh'}, {name: 'fadd_detail'},   
		        ])
		    });
		    
			var resultTpl_csrq = new Ext.XTemplate(
				'<tpl for="."><div class="search-item"  style="width:180px; height:25px; font-size:13px;">',
				'{fybkh} {fname}', '</div></tpl>'
			);
			
			
			//亲情关系
	        var fqqgx_store = new Ext.data.SimpleStore( {
						fields : [ 'fqqgx_id', 'fqqgx_desc' ],
						data : [ [ 1, '配偶' ], [ 2, '子' ], [ 3, '女' ], [ 9, '其他' ] ]});
			
			var sign_detail_form = new Ext.FormPanel(
			{
				region : 'center',
				url: 'xyj!signPatientXyj.do',
				method : 'POST',
				labelWidth : 5,
				frame : false,
				labelAlign: 'top',
				cls : 'key_dis',
				autoScroll : true,
				border : false,
				items : [ {
					layout : 'column',
					//labelAlign : 'right',
					border : false,
					frame : true,
					//    autoHeight : true,
					bodyStyle : 'padding-right:1px;padding-left:5px;padding-top:2px;ime-mode:disabled;',
					items : [ {
						columnWidth : .99,
						
						layout : "column",
						baseCls : "x-plain",
						//labelWidth : 1,
						items : [ {
				            xtype:'fieldset',
				            title: '基本信息',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								//labelWidth : 1,
								bodyStyle : 'padding-left:5px;',
								items : [new Ext.form.ComboBox({
								id : 'fybkh_form',
								name : 'fybkh',
								//	hiddenName : 'query', 
								fieldLabel : '医保卡号',
								store : ybkh_gjz_ds,
								displayField : 'fybkh',
								typeAhead : false,
								loadingText : 'Searching...',
								width : 180,
								height : 150,
								allowBlank : false,
								//maxLength : 8,
								//minLength : 3,
								enableKeyEvents : true, 
								scope: this,
		     					listeners: {
		       				    	'keydown': {key: [10,13], fn: function(o, evt) {
		                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
		                        				
		        								if (keyCode == 13) {
		        									//alert(Ext.getCmp("bh_id").getValue());
			                        			//	if(Ext.getCmp("bh_id").getValue() == null || Ext.getCmp("bh_id").getValue() == "") {
			                        			//		return false;
			                        			//	}
		                							Ext.getCmp("fphone1_form").focus(false,100);
										       }
		                             } , scope: this
		                             } 
		
		                       }, 
								//	valueField : 'fdesc',
								pageSize : 10,
								minChars : 3,
								displayInfo : false,
								tpl : resultTpl_csrq,
								itemSelector : 'div.search-item',
								onSelect : function(record) { // override default onSelect to do redirect
									if(record.data.fybkh == null || record.data.fybkh == "null" || record.data.fybkh == "") {
										return false;
									}
									//bh_gjz.setRawValue(record.data.cardNo);//record.data.keywords);
									Ext.getCmp("fybkh_form").setValue(record.data.fybkh);
									Ext.getCmp("fname_form").setValue(record.data.fname);
									Ext.getCmp("fidcd_form").setValue(record.data.fidcd);
									Ext.getCmp("fsex_form").setValue(record.data.fsex);
									Ext.getCmp("fphone2_form").setValue(record.data.fphone1);
									Ext.getCmp("fadd_detail_form").setValue(record.data.fadd_detail);
									Ext.getCmp("fpid_form").setValue(record.data.fpid);
									Ext.getCmp("fybkh_form").collapse(); //关闭下拉框
									
								}
							}), {
									xtype : 'textfield',
									fieldLabel : '家庭住址',
									name : 'fadd_detail',
									id : 'fadd_detail_form',
									allowBlank : true,
									width : 180
								} ]
							}, {
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								bodyStyle : 'padding-left:5px;',
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '身份证号',
									width : 180,
									id : 'fidcd_form',
									maxLength : 19,
									allowBlank : true,
								    name : 'fidcd',
									enableKeyEvents : true,
									scope: this,
			     					listeners: {
			       				    	'keydown': {key: [10,13], fn: function(o, evt) {
			                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
			        								if (keyCode == 13) {
			                							Ext.getCmp("fphone1_form").focus(false,100);
											       }
			                             } , scope: this
			                             } 
			                       }
								}, {
									xtype : 'textfield',
									fieldLabel : '合约手机号码',
									name : 'fphone1',
									id : 'fphone1_form',
									allowBlank : true,
									width : 180
								} ]
							}, {
								columnWidth : .2,
								layout : "form",
								bodyStyle : 'padding-left:5px;',
								baseCls : "x-plain",
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '姓名',
									width : 100,
									id : 'fname_form',
									maxLength : 20,
									allowBlank : false,
								    name : 'fname',
									enableKeyEvents : true,
									scope: this,
			     					listeners: {
			       				    	'keydown': {key: [10,13], fn: function(o, evt) {
			                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
			        								if (keyCode == 13) {
			                							Ext.getCmp("fphone1_form").focus(false,100);
											       }
			                             } , scope: this
			                             } 
			                       }
								} ]
							}, {
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '性别',
									name : 'fsex',
									id : 'fsex_form',
									allowBlank : true,
									width : 80
								},  {
									xtype : 'hidden',
									fieldLabel : 'fpid',
									name : 'fpid',
									id : 'fpid_form'
								} ]
							}
				            ]
				        }, {
				            xtype:'fieldset',
				            title: '服务项目',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
					                columnWidth:.7,
					                bodyStyle : 'padding-left:5px;',
					                layout: 'form',
					                items: [ {
						                xtype: 'checkboxgroup',
						                //fieldLabel: '服务',
						                labelSeparator : '', //不显示前面的名称  
						                
						                items: [
						                    {boxLabel: '血压监测', name: 'fxyjc'},
						                    {boxLabel: '血糖监测', name: 'fxtjc'},
						                    {boxLabel: '血脂', name: 'fxz'},
						                    {boxLabel: '血尿酸', name: 'fxns'},
						                    {boxLabel: '血肌酐', name: 'fjg'},
						                    {boxLabel: '血氧饱和度', name: 'fxybhd'},
						                    {boxLabel: '眼底', name: 'fyd'},
						                    {boxLabel: '心电', name: 'fxd'},
						                    {boxLabel: '位置服务', name: 'fwzfu'}
						                    
						                ]
						            }]
					            }
				            ]
				        }, {
				            xtype:'fieldset',
				            title: '亲情联系',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								//labelWidth : 1,
								bodyStyle : 'padding-left:5px;',
								items : [ {
									xtype : 'textfield',
									fieldLabel : '姓名',
									name : 'fname1_jtzx',
									id : 'fname1_jtzx_form',
									allowBlank : true,
									width : 150
								}, {
									xtype : 'textfield',
									fieldLabel : '姓名',
									name : 'fname2_jtzx',
									id : 'fname2_jtzx_form',
									allowBlank : true,
									width : 150
								} ]
							}, {
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								bodyStyle : 'padding-left:5px;',
								//labelWidth : 1,
								items : [ new Ext.form.ComboBox({
							                mode : 'local',
					                        hiddenName : 'fqqgx',
											id : 'fqqgx_id1',
											fieldLabel : '关系',
											valueField : 'fqqgx_id',
											displayField : 'fqqgx_desc',
											triggerAction : 'all',
						              		style:"cursor:pointer;color:blue",
						               		store : fqqgx_store,
							                width : 80
							            }), new Ext.form.ComboBox({
							                mode : 'local',
					                        hiddenName : 'fqqgx',
											id : 'fqqgx_id2',
											fieldLabel : '关系',
											valueField : 'fqqgx_id',
											displayField : 'fqqgx_desc',
											triggerAction : 'all',
						              		style:"cursor:pointer;color:blue",
						               		store : fqqgx_store,
							                width : 80
							            }) ]
							}, {
								columnWidth : .3,
								layout : "form",
								baseCls : "x-plain",
								bodyStyle : 'padding-left:5px;',
								//labelWidth : 1,
								items : [ {
									xtype : 'numberfield',
									fieldLabel : '亲情手机号码',
									name : 'fphone2',
									id : 'fphone2_form',
									allowBlank : true,
									width : 150
								}, {
									xtype : 'numberfield',
									fieldLabel : '亲情手机号码',
									name : 'fphone3',
									id : 'fphone3_form',
									allowBlank : true,
									width : 150
								} ]
							}
				            ]
				        } ]
					}
				 ]
				} ]
			});

			var btn_save_form = new Ext.Button({
				text : '保存',
				id : 'save_btn_id',
				enableKeyEvents : true,
				iconCls : 'sy-sure',
				handler : function(btn) {

					var frm = sign_detail_form.getForm();
					if (frm.isValid()) {

						frm.submit({
							waitTitle : '请稍候',
							waitMsg : '正在提交表单数据,请稍候...',
							success : function(form, action) {
								sign_detail_window.close();
								Ext.Msg.alert('', '签约成功！');
								
							},
							failure : function(form, action) {
								Ext.Msg.show({
									title : '错误提示',
									msg : action.result.message,
									buttons : Ext.Msg.OK,
									fn : function() {
										unfield.focus(true);
										btn.enable();
									},
									icon : Ext.Msg.ERROR
								});
							},// failure
							icon : Ext.Msg.ERROR
						});
					};// isValid
				}
			});

			var btn_reset_form = new Ext.Button({
				text : '取消',
				iconCls : 'sy-cancel',
				handler : function(btn) {
					sign_detail_window.close();
				}
			});

			var btn_reset_ym = new Ext.Button({
				text : '关闭',
				iconCls : 'sy-reset',
				handler : function(btn) {
					sign_detail_window.close();
				}
			});
				
			var sign_detail_window = new Ext.Window({
				tbar : [ btn_save_form, '-', btn_reset_form, '->', btn_reset_ym],
				//bbar : [ '->', btn_reset_ym ],
				width : document.body.offsetWidth,
				height : document.body.offsetHeight,
				title : '签约信息管理',
				iconCls : 'sy-win-flag',
				modal : true,
				items : [ sign_detail_form ]
			});
			sign_detail_window.show();

		} // end form
		
		
		
		
		//修改签约登记
		function sign_mod_fun(fpidStr, fnameStr, fsexStr, fadd_detailStr, fphone1Str, fphone2Str) {
		
			//根据"医保卡号"关键字查询
			var ybkh_gjz_ds = new Ext.data.Store({
				proxy : new Ext.data.HttpProxy({
					url : 'xyj!queryTipYbkh.do',
					method : 'POST'
				}),
				reader: new Ext.data.JsonReader({
		            root: 'root',
		            totalProperty: 'totalProperty',
		            id : 'ybkh'
		        }, [
		            {name: 'fybkh'}, {name: 'fname'}, {name: 'fpid'},  {name: 'fsex'}, {name: 'fidcd'},  {name: 'fphone2'}, {name: 'fjwh'}, {name: 'fadd_detail'},   
		        ])
		    });
		    
			var resultTpl_csrq = new Ext.XTemplate(
				'<tpl for="."><div class="search-item"  style="width:180px; height:25px; font-size:13px;">',
				'{fybkh} {fname}', '</div></tpl>'
			);
			
			var sign_detail_form = new Ext.FormPanel(
			{
				region : 'center',
				url: 'xyj!signPatientXyj.do',
				method : 'POST',
				labelWidth : 5,
				frame : false,
				labelAlign: 'top',
				cls : 'key_dis',
				autoScroll : true,
				border : false,
				items : [ {
					layout : 'column',
					//labelAlign : 'right',
					border : false,
					frame : true,
					//    autoHeight : true,
					bodyStyle : 'padding-right:1px;padding-left:5px;padding-top:2px;ime-mode:disabled;',
					items : [ {
						columnWidth : .99,
						layout : "column",
						baseCls : "x-plain",
						//labelWidth : 1,
						items : [ {
				            xtype:'fieldset',
				            title: '基本信息',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
								columnWidth : .2,
								layout : "form",
								baseCls : "x-plain",
								//labelWidth : 1,
								bodyStyle : 'padding-left:5px;',
								items : [new Ext.form.ComboBox({
								id : 'fybkh_form',
								name : 'fybkh',
								//	hiddenName : 'query', 
								fieldLabel : '医保卡号',
								store : ybkh_gjz_ds,
								displayField : 'fybkh',
								typeAhead : false,
								loadingText : 'Searching...',
								width : 180,
								height : 150,
								//maxLength : 8,
								//minLength : 3,
								enableKeyEvents : true, 
								scope: this,
								value : fpidStr,
		     					listeners: {
		       				    	'keydown': {key: [10,13], fn: function(o, evt) {
		                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
		                        				
		        								if (keyCode == 13) {
		        									//alert(Ext.getCmp("bh_id").getValue());
			                        			//	if(Ext.getCmp("bh_id").getValue() == null || Ext.getCmp("bh_id").getValue() == "") {
			                        			//		return false;
			                        			//	}
		                							Ext.getCmp("fphone1_form").focus(false,100);
										       }
		                             } , scope: this
		                             } 
		
		                       }, 
								//	valueField : 'fdesc',
								pageSize : 10,
								minChars : 3,
								displayInfo : false,
								tpl : resultTpl_csrq,
								itemSelector : 'div.search-item',
								onSelect : function(record) { // override default onSelect to do redirect
									if(record.data.fybkh == null || record.data.fybkh == "null" || record.data.fybkh == "") {
										return false;
									}
									//bh_gjz.setRawValue(record.data.cardNo);//record.data.keywords);
									Ext.getCmp("fybkh_form").setValue(record.data.fybkh);
									Ext.getCmp("fname_form").setValue(record.data.fname);
									Ext.getCmp("fsex_form").setValue(record.data.fsex);
									Ext.getCmp("fphone2_form").setValue(record.data.fphone1);
									Ext.getCmp("fphone3_form").setValue(record.data.fphone3);
									Ext.getCmp("fadd_detail_form").setValue(record.data.fadd_detail);
									Ext.getCmp("fpid_form").setValue(record.data.fpid);
									Ext.getCmp("fybkh_form").collapse(); //关闭下拉框
									
								}
							}), {
									xtype : 'textfield',
									fieldLabel : '分配手机号码',
									name : 'fphone1',
									id : 'fphone1_form',
									value : fphone1Str,
									allowBlank : true,
									width : 180
								} ]
							}, {
								columnWidth : .18,
								layout : "form",
								baseCls : "x-plain",
								bodyStyle : 'padding-left:5px;',
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '姓名',
									width : 150,
									id : 'fname_form',
									maxLength : 11,
									allowBlank : false,
								    name : 'fname',
									enableKeyEvents : true,
									scope: this,
									value : fnameStr,
			     					listeners: {
			       				    	'keydown': {key: [10,13], fn: function(o, evt) {
			                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
			        								if (keyCode == 13) {
			                							Ext.getCmp("fphone1_form").focus(false,100);
											       }
			                             } , scope: this
			                             } 
			                       }
								}, {
									xtype : 'textfield',
									fieldLabel : '亲情手机号码1',
									name : 'fphone2',
									id : 'fphone2_form',
									value : fphone2Str,
									allowBlank : true,
									width : 150
								}]
							}, {
								columnWidth : .18,
								layout : "form",
								bodyStyle : 'padding-left:5px;',
								baseCls : "x-plain",
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '性别',
									name : 'fsex',
									id : 'fsex_form',
									value : fsexStr,
									allowBlank : true,
									width : 80
								}, {
									xtype : 'textfield',
									fieldLabel : '亲情手机号码2',
									name : 'fphone3',
									id : 'fphone3_form',
									allowBlank : true,
									width : 150
								} ]
							}, {
								columnWidth : .4,
								layout : "form",
								baseCls : "x-plain",
								//labelWidth : 1,
								items : [ {
									xtype : 'textfield',
									fieldLabel : '家庭住址',
									name : 'fadd_detail',
									id : 'fadd_detail_form',
									allowBlank : true,
									value : fadd_detailStr,
									width : 200
								}, {
									xtype : 'hidden',
									fieldLabel : 'fpid',
									name : 'fpid',
									value : fpidStr,
									id : 'fpid_form'
								} ]
							}
				            ]
				        }, {
				            xtype:'fieldset',
				            title: '服务项目',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
					                columnWidth:.5,
					                bodyStyle : 'padding-left:5px;',
					                layout: 'form',
					                items: [ {
						                xtype: 'checkboxgroup',
						                //fieldLabel: '服务',
						                labelSeparator : '', //不显示前面的名称  
						                items: [
						                    {boxLabel: 'LIS检查结果告知', name: 'flis'},
						                    {boxLabel: '血压/血糖监测', name: 'fxyj'},
						                    {boxLabel: '用药提醒', name: 'fyytx'}
						                ]
						            }]
					            }
				            ]
				        }, {
				            xtype:'fieldset',
				            title: '临界值设定',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            autoHeight : true,
				            items :[{
					                columnWidth:.15,
					                layout: 'form',
					                bodyStyle : 'padding-left:5px;',
					                items: [ {
										xtype : 'numberfield',
										fieldLabel : '收缩压低临界值',
										width : 120,
										id : 'fssy_low_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fssy_low',
										enableKeyEvents : true,
										scope: this,
									//	value : '130',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}, {
										xtype : 'numberfield',
										fieldLabel : '收缩压高临界值',
										width : 120,
										id : 'fssy_high_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fssy_high',
										enableKeyEvents : true,
										scope: this,
									//	value : '139',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}]
					            }, {
					                columnWidth:.15,
					                layout: 'form',
					                bodyStyle : 'padding-left:5px;',
					                items: [ {
										xtype : 'numberfield',
										fieldLabel : '舒张压低临界值',
										width : 120,
										id : 'fszy_low_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fszy_low',
										enableKeyEvents : true,
										scope: this,
									//	value : '85',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}, {
										xtype : 'numberfield',
										fieldLabel : '舒张压高临界值',
										width : 120,
										id : 'fszy_high_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fszy_high',
										enableKeyEvents : true,
										scope: this,
									//	value : '89',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}]
					            }, {
					                columnWidth:.15,
					                layout: 'form',
					                bodyStyle : 'padding-left:5px;',
					                items: [ {
										xtype : 'numberfield',
										fieldLabel : '心率低临界值',
										width : 120,
										id : 'fxl_low_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fxl_low',
										enableKeyEvents : true,
										scope: this,
								//		value : '60',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}, {
										xtype : 'numberfield',
										fieldLabel : '心率高临界值',
										width : 120,
										id : 'fxl_high_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fxl_high',
										enableKeyEvents : true,
										scope: this,
								//		value : '100',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}]
					            }, {
					                columnWidth:.15,
					                layout: 'form',
					                bodyStyle : 'padding-left:5px;',
					                items: [ {
										xtype : 'numberfield',
										fieldLabel : '血糖低临界值',
										width : 120,
										id : 'fxt_low_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fxt_low',
										enableKeyEvents : true,
										scope: this,
								//		value : '3.9',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}, {
										xtype : 'numberfield',
										fieldLabel : '血糖高临界值',
										width : 120,
										id : 'fxt_high_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fxt_high',
										enableKeyEvents : true,
										scope: this,
								//		value : '6.1',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                							//Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}]
					            }, {
					                columnWidth:.2,
					                layout: 'form',
					                bodyStyle : 'padding-left:5px;',
					                items: [ {
										xtype : 'numberfield',
										fieldLabel : '轻度异常临界比例(%)',
										width : 120,
										id : 'fexception_low_form',
										maxLength : 11,
										allowBlank : true,
									    name : 'fexception_low',
										enableKeyEvents : true,
										scope: this,
								//		value : '3.9',
				     					listeners: {
				       				    	'keydown': {key: [10,13], fn: function(o, evt) {
				                        		var keyCode = evt.keyCode ? evt.keyCode : evt.charCode;
				        								if (keyCode == 13) {
				                							
				                						//	////Ext.getCmp("yydate_id1").focus(false,100);
												       }
				                             } , scope: this
				                             } 
				                       }
									}]
					            }
				            ]
				        }, {
				            xtype:'fieldset',
				            title: '规则设定',
				            collapsible: false,
				            layout : "column",
				           // collapsed : true,//收缩或展开
				            //height : 50,
				            labelAlign: 'left',
				            autoHeight : true,
				            items :[{
					                columnWidth:.5,
					                bodyStyle : 'padding-left:5px;',
					                layout: 'form',
					                items: [ {
						                xtype: 'checkboxgroup',
						                //fieldLabel: '服务',
						                labelSeparator : '', //不显示前面的名称  
						                items: [
						                    {boxLabel: '监测值严重异常告知亲情号码', name: 'fgz_exception'},
						                    {boxLabel: '定时测量血压短信提醒', name: 'fgz_time'}
						                ]
						            }]
					            }
				            ]
				        } ]
					}
				 ]
				} ]
			});

			var btn_save_form = new Ext.Button({
				text : '保存',
				id : 'save_btn_id',
				enableKeyEvents : true,
				iconCls : 'sy-sure',
				handler : function(btn) {

					var frm = sign_detail_form.getForm();
					if (frm.isValid()) {

						frm.submit({
							waitTitle : '请稍候',
							waitMsg : '正在提交表单数据,请稍候...',
							success : function(form, action) {
								sign_detail_window.close();
								Ext.Msg.alert('', '签约成功！');
								
							},
							failure : function(form, action) {
								Ext.Msg.show({
									title : '错误提示',
									msg : action.result.message,
									buttons : Ext.Msg.OK,
									fn : function() {
										unfield.focus(true);
										btn.enable();
									},
									icon : Ext.Msg.ERROR
								});
							},// failure
							icon : Ext.Msg.ERROR
						});
					};// isValid
				}
			});

			var btn_reset_form = new Ext.Button({
				text : '取消',
				iconCls : 'sy-cancel',
				handler : function(btn) {
					sign_detail_window.close();
				}
			});

			var btn_reset_ym = new Ext.Button({
				text : '关闭',
				iconCls : 'sy-reset',
				handler : function(btn) {
					sign_detail_window.close();
				}
			});
				
			var sign_detail_window = new Ext.Window({
				tbar : [ btn_save_form, '-', btn_reset_form, '->', btn_reset_ym],
				//bbar : [ '->', btn_reset_ym ],
				width : document.body.offsetWidth,
				height : document.body.offsetHeight,
				title : '签约信息管理',
				iconCls : 'sy-win-flag',
				modal : true,
				items : [ sign_detail_form ]
			});
			sign_detail_window.show();

		} // end form
		
		
		function show_chart_fun(fphoneStr, fnameStr) {
		
				var detailsPanel = {
					id: 'details-panel',
			        region: 'center',
			        bodyStyle: 'padding-bottom:15px;background:#FFFFFF;',
					autoScroll: true,
					html: '<table><tr><td id="chartdiv1"><td/></tr><tr><td height="20"><td/></tr><tr><td id="chartdiv2"><td/></tr></table>'
			    };
			    
				var panelmenu2 = new Ext.Panel({
					region: "north",
					split:true,
			        height : 300,
			        collapsible: false,
			        collapsed: false,
			        margins:'0 0 0 0',
			        layout:'fit',
			        layoutConfig:{
			            animate:true
			        },
			        autoScroll : true,
					items :[ detailsPanel ]
			   });	
			    
			    var btn_mess_send = new Ext.Button({
					text : '发送短信',
					iconCls : 'sy-send-info',
					handler : function() {
						Ext.Ajax.request( {
								url : 'mess!sendMess.do',
								params:{
				    	        	fphone : fphoneStr,
				    	        	fcontent : Ext.get("fsdxId").dom.value
					    	    },
								success : function() {
									Ext.MessageBox.alert('提示', '发送成功！');
								},
								failure : function() {
									Ext.Msg
											.show( {
												title : '错误提示',
												msg : '设置标记失败！！',
												buttons : Ext.Msg.OK,
												icon : Ext.Msg.ERROR
											});
								}
							});
					}
				});
				
				var btn_mess_clear = new Ext.Button({
					text : '清空短信',
					iconCls : 'sy-cancel',
					handler : function() {
						
					}
				});
			    
			    var data_form_send = new Ext.FormPanel(
				{
					region : 'center',
					labelWidth : 55,
					frame : true,
					labelAlign : 'right',
					autoScroll : true,
					border : false,
					items : [ {
					layout : 'table',  
				    layoutConfig : {  
				        columns : 3  
				    },frame : true,  
				    labelAlign : 'right',  
				    labelWidth : 1,  
				    items : [{  
				                layout : 'form',  
				                 bodyStyle : 'padding-left:1px;',
				                items : [
					                {  
					                    xtype : "textarea",  
					                    labelSeparator : '', //不显示前面的名称  
					                    //fieldLabel : "编辑短信:",  
					                    allowBlank:false,  
					                    id:'fsdxId',
					                    blankText:"短信内容不可以为空!",  
					                    emptyText : '请在此输入要发送的短信，短信内容不能超过140字！',
					                    width : 450,
					                    height : 90
					                }]  
					            },{  
					                layout : 'form',  
					                bodyStyle : 'padding-left:15px;padding-top:25px;',
					                items : [btn_mess_send, {html : '<pre>   </pre>'}, btn_mess_clear]  
					            }]  
					} ]
					
				});
			    
			    var panelmenu3 = new Ext.Panel({
					region: "center",
					split:true,
			        minSize: 100,
			        maxSize: 400,
			        collapsible: false,
			        collapsed: false,
			        margins:'0 0 0 0',
			        layout:'fit',
			        layoutConfig:{
			            animate:true
			        },
					items :[data_form_send]
			   });	
		
			    var panel_show = new Ext.Panel({
			    	region: "center",
					border : true,
					layout : "border",
					margins:'0 5 0 0',
					items : [panelmenu2, panelmenu3]
				});
				
				var btn_close = new Ext.Button({
					text : '关闭',
					iconCls : 'sy-reset',
					handler : function() {
						chart_window.close();
					}
				});
				
				var panel_right = new Ext.Panel({
					region: "east",
					split:true,
		            minSize: 105,
		            maxSize: 400,
		            title : '患者信息',
		            collapsible: true,
		            collapsed: true, //展开或关闭
		            margins:'0 0 0 0',
		            layout:'fit',
		            layoutConfig:{
		                animate:true
		            },
					items :[{html : ' '}],
					width:300
			   });
			   
			   
			   var chart_bdate = new Ext.form.TextField({
					fieldLabel : '开始日期',
					format: 'yyyy-MM-dd',
					id:'fbdate_id_chart',
					name:'fbdate',
					width : 90,
					style:"cursor:pointer;color:blue",
					listeners : {
						'focus' : function() {
							WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true});
						}
					}
				});
			
	           var chart_edate = new Ext.form.TextField({
	   				fieldLabel : '结束日期',
	   				format: 'yyyy-MM-dd',
	   				id:'fedate_id_chart',
					name:'fedate',
					width : 90,
					value : new Date().format('Y-m-d'),
	   				style:"cursor:pointer;color:blue",
	   				listeners : {
	   					'focus' : function() {
	   						WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd',alwaysUseStartDate:true});
	   					}
	   				}
	   			});
	   			
	   			var btn_search_chart = new Ext.Button({
					text : '查询',
					iconCls : 'sy-search',
					handler : function(btn) {
						
					document.getElementById("chartdiv1").innerHTML = "";
					document.getElementById("chartdiv2").innerHTML = "";	
						
					//血压曲线图
					Ext.Ajax.request({     
						url : 'xyj!produceXyjToChart.do',     
						method : 'POST',     
						params : {        
							'fphone1' : fphoneStr,        
							'fname' : fnameStr,
							'fbtime' : Ext.get('fbdate_id_chart').dom.value, 
							'fetime' : Ext.get('fedate_id_chart').dom.value  
							},     
						success : function(response, action) {        
							var myChart;        
							var responseText = response.responseText; 
							var pattern = new RegExp("^[\\s]+","gi");
        					var chart_data = responseText.replace(pattern,"");
							var myChart = new FusionCharts("../FusionCharts/MSLine.swf", "myChartId1", "650", "300", "0", "1");
							myChart.setDataXML(chart_data);
							myChart.render("chartdiv1");
						},     
						failure : function() {        
							Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
						}  
					});  
					
					//血压曲线图
					Ext.Ajax.request({     
						url : 'xyj!produceXtndToChart.do',     
						method : 'POST',     
						params : {        
							'fphone1' : fphoneStr,        
							'fname' : fnameStr,
							'fbtime' : Ext.get('fbdate_id_chart').dom.value, 
							'fetime' : Ext.get('fedate_id_chart').dom.value  
							},     
						success : function(response, action) {        
							var myChart;        
							var responseText = response.responseText; 
							var pattern = new RegExp("^[\\s]+","gi");
        					var chart_data = responseText.replace(pattern,"");
							var myChart = new FusionCharts("../FusionCharts/MSLine.swf", "myChartId2", "650", "280", "0", "1");
							myChart.setDataXML(chart_data);
							myChart.render("chartdiv2");
						},     
						failure : function() {        
							Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
						}  
					});  
					}
				});
			
					var chart_window = new Ext.Window({
						tbar : [ '统计开始日期：', chart_bdate, '-', '统计截止日期：',chart_edate, '-', btn_search_chart, '->', btn_close ],
						width : document.body.offsetWidth,
					    height : document.body.offsetHeight,
						title : '测量值变化曲线',
						layout : 'border', 
						iconCls : 'sy-win-flag',
						modal : true,
						items : [ panel_show, panel_right ]
					});
					chart_window.show();
					
					//血压曲线图
					Ext.Ajax.request({     
						url : 'xyj!produceXyjToChart.do',     
						method : 'POST',     
						params : {        
							'fphone1' : fphoneStr,        
							'fname' : fnameStr,
							'fbtime' : Ext.get('fbtime_id').dom.value, 
							'fetime' : Ext.get('fetime_id').dom.value  
							},     
						success : function(response, action) {        
							var myChart;        
							var responseText = response.responseText; 
							var pattern = new RegExp("^[\\s]+","gi");
        					var chart_data = responseText.replace(pattern,"");
							var myChart = new FusionCharts("../FusionCharts/MSLine.swf", "myChartId1", "650", "300", "0", "1");
							myChart.setDataXML(chart_data);
							myChart.render("chartdiv1");
						},     
						failure : function() {        
							Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
						}  
					});  
					
					//血压曲线图
					Ext.Ajax.request({     
						url : 'xyj!produceXtndToChart.do',     
						method : 'POST',     
						params : {        
							'fphone1' : fphoneStr,        
							'fname' : fnameStr,
							'fbtime' : Ext.get('fbtime_id').dom.value, 
							'fetime' : Ext.get('fetime_id').dom.value  
							},     
						success : function(response, action) {        
							var myChart;        
							var responseText = response.responseText; 
							var pattern = new RegExp("^[\\s]+","gi");
        					var chart_data = responseText.replace(pattern,"");
							var myChart = new FusionCharts("../FusionCharts/MSLine.swf", "myChartId2", "650", "280", "0", "1");
							myChart.setDataXML(chart_data);
							myChart.render("chartdiv2");
						},     
						failure : function() {        
							Ext.Msg.alert('错误', '服务器出现错误请稍后再试！');     
						}  
					});  
					
				} // end 
				
	
